package no.sachmuld.methodcombination.examples.reflection.roles;

import no.sachmuld.methodcombination.api.MethodCombinationSupport;

/**
 *
 */
public class MethodCombinationWithRoleSupport<R extends Role, B> extends MethodCombinationSupport<B> {


    final public <T extends R> T as(Class<T> cls) {
        for (B behaviour : chain().bottomUp()) {
            if (cls.isAssignableFrom(behaviour.getClass())) {
                return (T) behaviour;
            }
        }
        return null;
    }

}
